import {createRouter,createWebHashHistory} from 'vue-router'
//一级路由导入
import Layout from '@/views/layout/index.vue'
import Login from "@/views/login/index.vue"
//二级路由
import Home from "@/views/home/index.vue"
import Category from "@/views/category/index.vue"
import CategorySub from "@/views/category/sub.vue"
//测试
import playground from "@/views/playground/inxde.vue"

//创建路由
 const router = createRouter({
    history:createWebHashHistory(),
    routes:[
        {path:'/playground',component:()=>playground},  //测试
        {path:'/',component:Layout,children:[
            {path:'/',component:Home},
            {path:'/category/:id',component:()=>Category}, //一级分类
            {path:'/category/sub/:id',component:()=>CategorySub},  //二级分类
            //商品详情页
            {path:'/goods/:id',component:()=>import('@/views/goods/index.vue')},
            {path:'/cart',component:()=>import("@/views/cart/index.vue")},

        ]},
        {path:'/login',component:()=>Login},
        {path:'/login/callback',component:()=>import("@/views/login/callback.vue")},

    ]
})

export default router